define(function(){
    var $$ = bowlder;
    var state = {
        supportFile: $$("<input type='file'/>")[0].files !== undefined,
        supportFormData: window.FormData !== undefined
    };
    function img2File(src){
        var img = new Image;
        img.src = src;
    }
    function audio2File(src){
        var img = new Image;
        img.src = src;
    }
    function blob2File(blob, filename){
        var file = new File([blob], filename);
        return file;
    }
    function blob2Link(blob, filename){
        var a = document.createElement("a");
        a.href = window.URL.createObjectURL(blob);
        a.download = filename;
        a.textContent = filename;
        return a;
    }
    function file2Blob(content, format){
        format = format || {type: "text/javascript"};
        var blob = new Blob(content, format);
        return blob;
    }
    function uploadFile(file){
        var putPolicy = {
            Bucket: "cms-bucket",
            Object: "objectName",
            Expires: Math.ceil(+new Date/1000) + 3600*24,
            CallbackUrl: "http://app.example.com/",
            CallbackBody: "",
            ReturnUrl: "http://redirect.example.com/",
            ReturnBody: ""
        };
        var data = {
            "x-nos-token": "",
            Object: "object_name_in_nos",
            file: ""
        };
        $$.ajax({
            url: "http://nos.netease.com/bucket",
            method: "post",
            headers: {
                "Content-Type": false
            }
        });
    }
    /**
     * File Reader
     > readAsBinaryString(Blob|File)：返回二进制字符串，该字符串每个字节包含一个0到255之间的整数。
     > readAsText(Blob|File, opt_encoding)：返回文本字符串。默认情况下，文本编码格式是’UTF-8’，可以通过可选的格式参数，指定其他编码格式的文本。
     > readAsDataURL(Blob|File)：返回一个基于Base64编码的data-uri对象。
     > readAsArrayBuffer(Blob|File)：返回一个ArrayBuffer对象。
     */
    return {
        img2File: img2File,
        blob2File: blob2File,
        audio2File: audio2File,
        file2Blob: file2Blob
    }
});
